package org.xhy.quickstarter.interceptor;

import org.springframework.web.servlet.HandlerInterceptor;
import org.xhy.quickstarter.authority.utils.JwtUtils;
import org.xhy.quickstarter.holder.UserHolder;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @description:
 * @Author: Xhy
 * @CreateTime: 2023-11-13 13:44
 */
public class Interceptor implements HandlerInterceptor {
    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {

        UserHolder.set(JwtUtils.getUserId(request));

        return true;
    }
}
